package com.zyh.util;

import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;

import java.net.InetAddress;

public class ESUtils {
    public static TransportClient getClient(){
        try {
            TransportClient transportClient = new PreBuiltTransportClient(Settings.EMPTY)
                    .addTransportAddress(new TransportAddress(InetAddress.getByName("192.168.193.100"), 9300));
            return transportClient;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}